﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class EditPasswd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AdminName"] == null)
            Response.Redirect("login.aspx");
    }


    protected void cmdAddupdate_Click(object sender, EventArgs e)
    {
        string username = Session["AdminName"].ToString();
        DAL.UserDALs userdals = new DAL.UserDALs();

        Entities.User user = userdals.GetByName(username);

        if (user.Password != this.TxtOldPasswd.Text)
        {
            Response.Write("<font>老密码输入错误，请重新输入</font>");
            return;
        }

        userdals.updatepasswd(this.TxtNewPasswd.Text,user.User_id);
        Response.Redirect("oprrecord.aspx");
    }
}
